<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>私信详情</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="/js/plugins/bootstrap-4.1.1-dist/css/bootstrap.min.css">
    <script src="/js/plugins/jquery/jquery.min.js"></script>
    <script src="/js/plugins/bootstrap-4.1.1-dist/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="/css/font/css/font-awesome.min.css">
    <link rel="stylesheet" href="/css/reset.css"/>
    <link rel="stylesheet" href="/css/travelContent.css"/>
    <script src="/js/plugins/jrender/jrender.min.js"></script>
    <script src="/js/plugins/form/jquery.form.js"></script>
    <script src="/js/common.js"></script>
    <script>
        $(function () {
            var params = getParams();
            console.log(params);
            if (params.id) {
                $.get('/privateMessages', {id: params.id}, function (data) {
                    console.log(data);
                    $(".travels").renderValues(data, {
                        getHref: function (item, value) {
                            var href = $(item).data("href");
                            $(item).attr("href", href + value);
                        }
                    });
                });
            }
            $("#deleteBtn").click(function () {
                $("#deleteForm").ajaxSubmit(function (data) {
                    if (data.success) {
                        window.location.href = "/mine/privateLetter.html"
                    }
                })
            });
            $.ajax({
                url: "/privateMessages/" + params.id,
                type: "PUT",
                success: function (data) {
                    console.log(data);
                }
            });
        });
    </script>
</head>
<body>
<div class="search-head">
    <div class="row nav-search">
        <div class="col">
            <a href="/mine/privateLetter.html">
                <span><i class="fa fa-chevron-left"></i></span>
            </a>
        </div>
        <div class="col">
            <span>我的私信详情</span>
        </div>
        <div class="col"></div>
    </div>
</div>
<hr>
<div class="travels">
    <div class="container">
        <small>
            发送时间: <span render-html="sendTime"></span>
        </small>
        <div class="row">
            <div class="col-2 img">
                <a data-href="/userProfiles.html?authorId=" render-key="senderId" render-fun="getHref" class="aui-news-item">
                    <img class="rounded-circle" render-src="user.headImgUrl">
                </a>
            </div>
            <div class="col-6 mine">
                <small>
                    <span render-html="user.nickName"></span>
                    <br>
                    <span>0 </span>篇游记
                    <span render-html="user.fans"></span>粉丝
                </small>
            </div>
            <div class="attention col">
                <span class="addr" render-html="user.place"></span>
            </div>
        </div>
    </div>
    <div class="container">
        <fieldset>
            <legend><h5>私信内容</h5></legend>
            <div class="content">
                <p render-html="messageContent"></p>
            </div>
        </fieldset>
    </div>
    <hr>
    <form action="/privateMessages" method="post" id="deleteForm">
        <input type="hidden" name="id" render-value="id">
        <input type="hidden" name="_method" value="DELETE">
    </form>
    <div class="">
        <button type="button" class="btn-danger btn btn-lg btn-block" id="deleteBtn" style='font-size:30px'><span class="glyphicon glyphicon-trash" aria-hidden="true"></span>删除
        </button>
    </div>
</div>
</body>

</html>